<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templateclean.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListWebserviceTitle_ultimosDados}"></h:outputText>
        </ui:define>
        <ui:define name="body">

            <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block" >
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="list" />
            </h:panelGroup>

            <p:dataTable id="tblUltimosDados" value="#{webServiceController.listaUltimosDados}" filteredValue="#{webServiceController.listaUltimosDados}"
                         var="item"  paginator="true" rows="100" 
                         pageLinks="5" widgetVar="ultimosDadosTable" currentPageReportTemplate="#{bundle.currentPageReportTemplateEstacoes}"  
                         paginatorTemplate="#{bundle.paginatorTemplate}"   
                         paginatorPosition="#{bundle.paginatorPosition}" rowKey="#{item.codigo}" emptyMessage="#{bundle.ListEstacaoEmpty}" styleClass="mystyle">


                <p:column exportable="true" styleClass="firstColumn" sortBy="#{item.codigo}" filterBy="#{item.codigo}" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="Codigo"/>
                    </f:facet> 
                    <h:outputText value="#{item.codigo}"/>
                </p:column> 

                <p:column exportable="true" sortBy="#{item.estNome}" filterBy="#{item.estNome}" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="Nome"/>
                    </f:facet> 
                    <h:outputText value="#{item.estNome}"/>
                </p:column> 

                <p:column exportable="true" styleClass="firstColumn" sortBy="#{item.estCodigoFlu}" filterBy="#{item.estCodigoFlu}" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="Codigo FLU"/>
                    </f:facet> 
                    <h:outputText value="#{item.estCodigoFlu}"/>
                </p:column>  

                <p:column exportable="true" styleClass="firstColumn" sortBy="#{item.estCodigoPlu}" filterBy="#{item.estCodigoPlu}" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="Codigo PLU"/>
                    </f:facet> 
                    <h:outputText value="#{item.estCodigoPlu}"/>
                </p:column>  

                <p:column exportable="true" styleClass="firstColumn" sortBy="#{filterSearchController.customFormatDate1(item.horDataHora)}" 
                          filterBy="#{filterSearchController.customFormatDate(item.horDataHora)}" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="#{bundle.ListWebserviceTitle_dtHoraDaMedicao}"/>
                    </f:facet>
                    <h:outputText value="#{item.horDataHora}">
                        <f:convertDateTime  pattern="#{bundle.patternAppDataHora}" timeZone="#{filterSearchController.timeZone}"/>
                    </h:outputText>
                </p:column>  


                <p:column exportable="true" styleClass="firstColumn" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="Chuva: "/>
                    </f:facet> 
                    <h:outputText value="#{item.horChuva}" >
                        <f:convertNumber locale="#{bundle.localeApp}" maxFractionDigits="#{bundle.maxFractionDigits}" minFractionDigits="#{bundle.minFractionDigits}"/>
                    </h:outputText>
                </p:column>       

                <p:column exportable="true" styleClass="firstColumn" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="Nivel"/>
                    </f:facet> 
                    <h:outputText value="#{item.horNivel}" >
                        <f:convertNumber locale="#{bundle.localeApp}" maxFractionDigits="#{bundle.maxFractionDigits}" minFractionDigits="#{bundle.minFractionDigits}"/>
                    </h:outputText>
                </p:column>

                <p:column exportable="true" styleClass="firstColumn" filterMatchMode="contains">
                    <f:facet name="header">
                        <h:outputText styleClass="cabecalhoNegrito" value="Vazao"/>
                    </f:facet> 
                    <h:outputText value="#{item.horVazao}" >
                        <f:convertNumber locale="#{bundle.localeApp}" maxFractionDigits="#{bundle.maxFractionDigits}" minFractionDigits="#{bundle.minFractionDigits}"/>
                    </h:outputText>
                </p:column>


                <f:facet name="footer">
                    <p:commandButton id="excelExportAll" ajax="false" value="#{bundle.excelExportAll}" icon="#{bundle.icone_script}">
                        <p:dataExporter  type="xls" target="tblUltimosDados" fileName="#{bundle.excelExportAllFileName_ultimosDados}" postProcessor="#{filterSearchController.postProcessorXLS}"/>
                    </p:commandButton>
                </f:facet>

            </p:dataTable>

            <p:ajaxStatus style="width:64px;height:64px;position:fixed;right:5px;bottom:5px;" id="ajaxStatusPanel">
                <f:facet name="start">
                    <h:graphicImage id="loading_template" value="#{bundle.loadingGif}" />
                </f:facet>

                <f:facet name="complete">
                    <h:outputText id="txt_template" value="" />
                </f:facet>
            </p:ajaxStatus>            
            
            
        </ui:define>
    </ui:composition>

</html>
